Quiz answers and explanations

Congratulations on passing the final quiz for this week! Here are the answers and explanations for the quiz questions. Correct answers are in bold . Incorrect answers are indicated in italics .

  1. What is the tightest bound Big-O running time of the brute force solution to the traveling salesperson problem (TSP), where n is the number of nodes in the graph?

You can find the explanation for why in Core: TSP Algorithm Running Time

2. If you know that a problem is considered NP Hard, that means:

Remember that no one knows whether there are polynomial time solutions to some of the problems that are NP Hard. If P = NP, then there will be a polynomial time solution to some NP Hard problems (namely, those in NP).

Great response! These problems are either in NP or harder than those in NP.

In fact, no one knows whether P = NP. But even if so, there will still be NP Hard problems (which are not in NP) that don't have a polynomial time solution.

If you have more questions, please review the video - Core: NP Hard Problems

3. For which of the graphs below would the greedy algorithm (nearest neighbor) NOT find the best solution to the Travelling Salesperson Problem assuming A is the start vertex. Again, each node must be visited once and you must return back to A.

Nicely done! Greedy would find the non optimal path of A->B->D->C->A when A->C->B->D->A is better.

In the graph below, the greedy algorithm would find the shortest path which is A->C->D->B->A because the lowest weight edge from each vertex will take you around the edge of the graph.

In the graph below, the greedy algorithm will find the lowest-weight path A->C->B->D->A.

If you have more questions, please review the Concept Challenge from this week along with Core: Approximations and Heuristics .

4. Which of the following is true about the 2-opt heuristic as explained this week?

For an explanation of the 2-opt heuristic please review Core: Approximations and Heuristics .

5. A Hamiltonian graph is one where there's some path through the graph which visits every vertex exactly once. An Eulerian graph is one where there's some path through the graph which traverses every edge exactly once.

Which of the following is true about Hamiltonian and Eulerian graphs?

(Select all that apply.)

A Hamiltonian path just has to visit each vertex exactly once. It might not use all of the edges.

A graph might be both Hamiltonian and Eulerian, or neither Hamiltonian nor Eulerian.

An example of such a graph is a fully connected graph with 4 nodes.

For more information about this question, please see: Core: Eulerian Graphs